from datetime import timedelta

import logging
from redis import StrictRedis



class Config(object):
    #Debug模式
    DEBUG = True
    SECRET_KEY="ASDFASDFADS"



    REDIS_HOST = '127.0.0.1'
    REDIS_PORT = 6379

    SQLALCHEMY_DATABASE_URI = "mysql+pymysql://root:mysql@127.0.0.1:3306/information17"
    SQLALCHEMY_TRACK_MODIFICATIONS= False
    SQLALCHEMY_COMMIT_ON_TEARDOWN = True  #当绘画结束的时候自动提交


#     配置session信息
    SESSION_TYPE = "redis"
    SESSION_USE_SIGER = True
    SESSION_REDIS = StrictRedis(host=REDIS_HOST,port=REDIS_PORT)
    PERMANENT_SESSION_LIFETIME = timedelta(days=2) #设置两天有效

    #设置日志级别
    LEVEL_NAME = logging.DEBUG


#开发阶段配置信息
class DevelopConfig(Config):
    pass

#生产（线上)阶段

class ProductConfig(Config):
    DEBUG = False
    LEVEL_NAME = logging.ERROR

#测试阶段
class TestConfig(Config):
    TESTING=True

#提供配置信息访问入口
config_dict={
    "Develop":DevelopConfig,
    "Product":ProductConfig,
    "TEST":TestConfig
}
